package com.shenmazong.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2022/1/19 11:51
 */

@RestController
@Slf4j
public class ProductController {

    @Autowired
    RabbitTemplate rabbitTemplate;

    private Integer id = 0;

    @GetMapping(value = "/send")
    public String send() {
        String message = "message:"+id++;
        rabbitTemplate.convertAndSend("hello", message);

        return message;
    }
}
